package com.yantong.service;


import com.yantong.pojo.Balance;
import com.yantong.pojo.BalanceCWLog;
import com.yantong.pojo.BalanceLog;
import com.yantong.pojo.vo.BalanceExcelVo;
import com.yantong.utils.PageUtils;

import java.util.Date;
import java.util.List;

/**
 * 余额服务
 *
 * @author kanghaixin
 * @date 2018/9/16.9:17
 */
public interface BalanceService {
    /**
     * 余额列表数据
     *
     * @param role
     * @param start
     * @param end
     * @param queryItem
     * @param centreId
     * @param offset
     * @param limit
     * @return
     */
    PageUtils<Balance> listBalances(Integer role, Date start, Date end, String queryItem, Long centreId, Long teamId, int offset, int limit);

    /**
     * 余额列表 不分页
     *
     * @param role
     * @param start
     * @param end
     * @param queryItem
     * @param centreId
     * @return
     */
    List<Balance> listBalances(Integer role, Date start, Date end, String queryItem, Long centreId);

    /**
     * 获取会员余额详情
     *
     * @param mid
     * @return
     */
    Balance getBalanceDetail(Long mid);

    /**
     * 获取条件筛选下的余额总和
     *
     * @param role
     * @param start
     * @param end
     * @param queryItem
     * @param centreId
     * @return
     */
    double getBalanceSum(Integer role, Date start, Date end, String queryItem, Long centreId);

    /**
     * 余额充值
     *
     * @param mid
     * @param money
     * @param remark
     * @param title
     * @param style  余额流水类型
     * @return
     */
    int recharge(Long mid, Double money, Integer style, String title, String remark);

    /**
     * 余额充值
     *
     * @param mid
     * @param money
     * @param remark
     * @param title
     * @param style  余额流水类型
     * @return
     */
    int tfbRecharge(Long mid, Double money, Integer style, String title, String remark);

    /**
     * 余额扣款
     *
     * @param mid
     * @param money
     * @param title
     * @param style
     * @param remark
     * @return
     */
    int deduct(Long mid, Double money, Integer style, String title, String remark, Long shipcardId, String shipcardName);

    /**
     * 购物卡扣款
     *
     * @param mid
     * @param money
     * @param title
     * @param style
     * @param remark
     * @return
     */
    int deductOfShipcard(Long mid, Double money, Integer style, String title, String remark, Long shipcardId);

    /**
     * 余额提现
     *source:来源，根据该参数判断是前端发起提现申请 还是 后台申请提现
     * @param mid
     * @param money
     * @param remark
     * @return
     */
    int cash(Long mid, Double money, String remark, String isgys, String bankcard);

    /**
     * 余额流水记录
     *
     * @param centreId
     * @param start
     * @param end
     * @param style
     * @param queryItem
     * @param offset
     * @param limit
     * @return
     */
    PageUtils<BalanceLog> listBalanceLogs(Long centreId, Long teamId, Date start, Date end, Integer style, String queryItem, String source, String flowtype,
                                          int offset, int limit);

    /**
     * 余额流水记录列表
     *
     * @param centreId
     * @param start
     * @param end
     * @param style
     * @param queryItem
     * @return
     */
    List<BalanceLog> listBalanceLogs(Long centreId, Long teamId, Date start, Date end, Integer style, String queryItem, String source, String flowtype);


    /**
     * 余额流水记录
     *
     * @param balanceLog
     * @param offset
     * @param limit
     * @return
     */
    PageUtils<BalanceLog> listBalanceLogs(BalanceLog balanceLog, int offset, int limit);

    /**
     * 余额流水记录(前台)
     *
     * @param balanceLog
     * @param offset
     * @param limit
     * @return
     */
    PageUtils<BalanceLog> listBalanceLogsBefore(BalanceLog balanceLog, int offset, int limit);


    /**
     * 后台余额列表余额充值
     *
     * @param mid
     * @param money
     * @param remark
     * @param title
     * @param style  余额流水类型
     * @return
     */
    int balanceRecharge(Long mid, Double money, Integer style, String title, String remark);

    /**
     * 后台余额列表余额扣款
     *
     * @param mid
     * @param money
     * @param title
     * @param style
     * @param remark
     * @return
     */
    int balanceDeduct(Long mid, Double money, Integer style, String title, String remark);

    /**
     * 批量充值
     *
     * @param list
     * @return
     */
    int batchRecharge(List<BalanceExcelVo> list);

    /**
     * 得到账户供应商流水
     * @param mid
     * @param offset
     * @param limit
     * @return
     */
    PageUtils<BalanceLog> getsupllyBalanceLog(Long mid, Long flowtype, int offset, int limit);

    /**
     * 退款，商户打款给用户，扣除商户余额
     */
    int takeMoney(Long mid, Double money, Integer style, String title, String remark, String workson, Long orderCentreId);

	PageUtils<BalanceCWLog> listSupplyCwBalanceLogs(Long centreId, Date start, Date end, Integer style,
                                                    String queryItem, String realname, String mobile, String nickname, String flowtype, int offset, int limit);

	List<BalanceCWLog> listAllBalanceLogs(Long centreId, Date start, Date end, Integer style, String queryItem,
                                          String realname, String mobile, String nickname, String flowtype);

	   /**
     * 总金额
     *
     * @param centreId
     * @param start
     * @param end
     * @param style
     * @param queryItem
     * @param offset
     * @param limit
     * @return
     */
   String sumByMoney(Long centreId, Long teamId, Date start, Date end, Integer style, String queryItem, String source, String flowtype);

   /**
    * 购物卡退款
    * @param mid
    * @param money
    * @param style
    * @param title
    * @param remark
    * @param shipcardRecordId
    * @return
    */
    int rechargeOfShipcard(Long mid, Double money, Integer style, String title, String remark, Long shipcardRecordId);
}
